package com.tg.paw.ums.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.tg.paw.common.entity.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

import java.util.Date;
import java.util.List;

/**
 * <p>
 * 管理员
 * </p>
 *
 * @author Rubble
 * @since 2020-10-21
 */
@Data
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("ums_admin")
@ApiModel(value="Admin对象", description="管理员")
public class Admin extends BaseEntity {


    @ApiModelProperty(value = "主键")
    @TableId(value = "admin_id", type = IdType.AUTO)
    @JsonSerialize(using= ToStringSerializer.class)
    private Long adminId;

    @ApiModelProperty(value = "用户名")
    @TableField("admin_name")
    private String adminName;

    @ApiModelProperty(value = "密码")
    @TableField("password")
    private String password;

    @ApiModelProperty(value = "手机")
    @TableField("phone")
    private String phone;

    @ApiModelProperty(value = "邮箱")
    @TableField("email")
    private String email;

    @ApiModelProperty(value = "微信openId")
    @TableField("open_id")
    private String openId;

    @ApiModelProperty(value = "昵称")
    @TableField("nick_name")
    private String nickName;

    @ApiModelProperty(value = "真实姓名")
    @TableField("real_name")
    private String realName;

    @ApiModelProperty(value = "头像")
    @TableField("avatar")
    private String avatar;

    @ApiModelProperty(value = "国家地区")
    @TableField("country")
    private String country;

    @ApiModelProperty(value = "性别 (1: 男; 2: 女; 0: 未知)")
    @TableField("gender")
    private Integer gender;

    @ApiModelProperty(value = "省")
    @TableField("province")
    private String province;

    @ApiModelProperty(value = "市")
    @TableField("city")
    private String city;

    @ApiModelProperty(value = "备注信息")
    @TableField("remark")
    private String remark;

    @ApiModelProperty(value = "状态  (0: 禁用; 1: 启用)")
    @TableField("status")
    private Integer status;

    @ApiModelProperty(value = "类型 (0: 后台账号; 1: 店铺账号)")
    @TableField("user_type")
    private Integer userType;

    @ApiModelProperty(value = "角色id")
    @TableField("role_id")
    @JsonSerialize(using= ToStringSerializer.class)
    private Long roleId;

    @ApiModelProperty(value = "角色名称")
    @TableField("role_name")
    private String roleName;

    @ApiModelProperty(value = "最后登录时间")
    @TableField("login_time")
    private Date loginTime;

    @ApiModelProperty(value = "父账号id")
    @TableField("parent_id")
    @JsonSerialize(using= ToStringSerializer.class)
    private Long parentId;

    @ApiModelProperty(value = "逻辑删除 (0: 正常; 1: 删除)")
    @TableField("delete_status")
    @TableLogic
    private Integer deleteStatus;

    @ApiModelProperty(value = "创建时间")
    @TableField(value = "create_time", fill = FieldFill.INSERT)
    private Date createTime;

    @ApiModelProperty(value = "创建者")
    @TableField(value = "creator", fill = FieldFill.INSERT)
    private String creator;

    @ApiModelProperty(value = "更新时间")
    @TableField(value = "update_time", fill = FieldFill.UPDATE)
    private Date updateTime;

    @ApiModelProperty(value = "修改者")
    @TableField(value = "modifier", fill = FieldFill.UPDATE)
    private String modifier;

    @ApiModelProperty(value = "角色")
    @TableField(exist = false)
    private List<Role> roles;

}
